home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / forth_83.zoo / assemble.scr < prev    next >
Text File  |  1992-04-07  |  19KB  |  1 lines

  1. \\                     *** Assembler ***               12jul87we                                                                Dieses File enthält den 68000-Assembler für volksFORTH-83.      Der Assembler basiert auf dem von Michael Perry für F83 entwik- kelten, enthält aber einige zusätzliche Features.               Wegen der Heap-Struktur im volksFORTH sind z.B. echte Labels    verwendbar. Aus Geschwindigkeitsgründen enthält der Assembler   kaum Fehlerüberprüfung, es empfiehlt sich daher, nach getaner   Tat die Code-Worte mit einem Disassembler zu überprüfen.                                                                        Screen 2 enthält einen Loadscreen, mit dem man den kompletten   Assembler auf den Heap laden kann, damit er während der Kompila-tionszeit zur Verfügung steht, aber keinen Platz im Dictionary  verbraucht. Mit  CLEAR  oder  SAVE  wird der Assembler entfernt,wenn er nicht mehr benötigt wird.                                                                                               \ 68000 Assembler Load Screen                          26oct86we                                                                Onlyforth                                                       Vocabulary Assembler   Assembler also definitions                                                                               : end-code   context 2- @  context ! ;                          ' swap  | Alias  *swap                                                                                                          base @  4 $11 +thru  base !                                                                                                     : reg)        size push   .l 0 *swap  FP DI) ;                  : Next        .w IP )+ D7 move   D7 reg) D6 move   D6 reg) jmp                >here next-link @ ,  next-link !  ;                                                                               2 3 +thru     Onlyforth                                                                                                         \ Internal Assembler                                   09sep86we                                                                Onlyforth                                                                                                                       here                                                                $1300 hallot    heap dp !    -1 +load                       dp !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \ Extended adressing modes                             09sep86we                                                                : R#)    ( addr -- )        size push                              [ Forth ] dup  0< IF  [ Assembler ] .w # D6 move   D6 reg)      [ Forth ] exit  THEN     .w FP D) ;                                                                                                                                                          | : inrange?   ( addr -- offset f )    [ Forth ]                    >here 2+ -  >here 0< IF  dup  $FFFE >here - < exit  THEN                                 dup  >here negate  > ;             : pcrel)       ( addr -- )     \ pc-relativ adressing mode         inrange? [ Forth ] 0= abort" out of range"   pcd) ;                                                                          : ;c:         0 recover R#) jsr  end-code ] ;                                                                                                                                                   \ Assembler Forth words                                09sep86weForth definitions                                               : Assembler     Assembler [ Assembler ] .w ;                    : Code          Create  here dup 2- ! Assembler ;                                                                               | : (;code      r> last @ name> ! ;                             : ;Code         0 ?pairs  compile (;code  [compile] [  reveal                   Assembler ;    immediate restrict                                                                               : >label   ( addr -- )      here  | Create  swap ,  immediate                   4 hallot   >here 4- heap 4 cmove                                heap  last @   count $1F and + even !    dp !                   Does>  ( -- addr ) @                                             state @ IF  [compile] Literal  THEN ;          : Label        [ Assembler ] >here  [ Forth ] 1 and                            [ Assembler ] >allot    >here >label  Assembler ;\ Code generating primitives                           26oct86we                                                                Variable >codes                                                 | Create nrc ] c, , c@ here allot ! c! [                                                                                        : nonrelocate   nrc >codes ! ;      nonrelocate                                                                                 | : >exec   Create  c,                                                      Does>  c@  >codes @  +  @  execute ;                                                                                |   0 >exec >c,       |  2 >exec >,       |   4 >exec >c@       |   6 >exec >here     |  8 >exec >allot   | $0A >exec >!        | $0C >exec >c!                                                                                                                                                                                                                                                 \ 68000 Meta Assembler                                 04sep86we                                                                | : ?,          IF >, THEN >, ;                                 | : 2,          >, >, ;                                         8 base !                                                        Variable size                                                   : .b            10000 size ! ;                                  : .w            30100 size ! ; .w                               : .l            24600 size ! ;                                                                                                  | : Sz          Constant    Does> @  size @  and  or ;          00300 | Sz sz3            00400 | Sz sz4                        04000 | Sz sz40           30000 | Sz sz300                                                                                      | : long?       size @  24600 = ;                               | : -sz1        long? IF  100 or  THEN ;                        \ addressing modes                                     09sep86we                                                                | : Regs   10 0 DO  dup 1001 I * or  Constant  LOOP  drop ;     | : Mode    Constant    Does>  @ *swap  7007 and  or ;          0000 Regs     D0   D1   D2   D3   D4   D5   D6   D7             0110 Regs     A0   A1   A2   A3   A4   A5   A6   A7             0220 Mode     )         \ address register indirect             0330 Mode     )+        \ adr reg ind post-increment            0440 Mode     -)        \ adr reg ind pre-decrement             0550 Mode     D)        \ adr reg ind displaced                 0660 Mode     (DI)      \ adr reg ind displaced indexed s.u.    0770 Constant #)        \ immediate address                     1771 Constant L#)       \ immediate long address                2772 Constant pcD)      \ pc relative displaced                 3773 Constant (pcDI)    \ pc relative displaced indexed         4774 Constant #         \ immediate data